within ThreeD_MBS_Dynamics.Examples.RollingDisc;

model RollingDisc
  extends RigidBody;
  parameter SI.Acceleration[3] Gravity;
  // Disc radius
  parameter SI.Radius r1;
  VisualShape Disc(
    r0={0,0,-0.005},
    Shape="cylinder",
    LengthDirection={0,0,1},
    WidthDirection={1,0,0},
    Length=0.01,
    Width=2*r1,
    Height=2*r1,
    Material={0.5,0.8,1,0.2});
  VisualShape Rod(
    r0={0,0,0.02},
    Shape="box",
    LengthDirection={0,-1,0},
    WidthDirection={0,0,1},
    Length=r1 - 0.05,
    Width=0.02,
    Height=0.05,
    Material={0.5,0.5,1,0.5});
  WrenchPort InPortRoll annotation (extent=[-40, 80; -20, 100]);
  SI.Force[3] F1;
  SI.Torque[3] M1;
equation
  Disc.S = T;
  Disc.r = r;
  Rod.S = T;
  Rod.r = r;
  F = m*Gravity + InPortRoll.F + F1;
  M = InPortRoll.M + cross(InPortRoll.P - r, InPortRoll.F) + M1;
  annotation (Diagram);
end RollingDisc;
